package com.gigi.enums;

import java.util.stream.Stream;

/**
 * 性别枚举
 */
public enum GenderEnum {
    MALE(0, "男"),
    FEMALE(1, "女");

    private Integer code;
    private String desc;

    GenderEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public static GenderEnum getEnumByCode(final Integer code) {
        return Stream.of(GenderEnum.values()).filter(item -> item.code.equals(code)).findFirst().orElse(null);
    }

}
